<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ title }}</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/framer-motion/10.16.4/framer-motion.dev.js"></script>
    <!-- Example using Font Awesome (replace with your preferred icon library if needed) -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

        :root {
            /* New Palette: Light, Clean, Futuristic with Teal/Aqua accents */
            --bg-color: #f8fafc; /* Tailwind slate-50 (Very Light Gray) */
            --card-bg-color: #ffffff; /* White */
            --text-color: #1e293b; /* Tailwind slate-800 (Dark Gray-Blue) */
            --text-muted-color: #64748b; /* Tailwind slate-500 (Medium Gray-Blue) */
            --header-color: #0f172a; /* Tailwind slate-900 (Very Dark Blue) */
            --highlight-primary: #14b8a6; /* Tailwind teal-500 */
            --highlight-secondary: #67e8f9; /* Tailwind cyan-300 */
            --border-color: #e2e8f0; /* Tailwind slate-200 (Light Gray) */
            --shadow-color: rgba(15, 23, 42, 0.08); /* Subtle shadow based on slate-900 */
        }

        body {
            background-color: var(--bg-color);
            color: var(--text-color);
            font-family: 'Inter', sans-serif;
            overflow-x: hidden; /* Prevent horizontal scroll */
            line-height: 1.6;
        }

        .bento-grid {
            display: grid;
            gap: 1.5rem; /* Tailwind gap-6 */
            grid-template-columns: 1fr; /* Force single column */
            padding-bottom: 4rem; /* Add padding at the bottom */
        }

        .bento-item {
            /* Apply semi-transparent white background and blur */
            background-color: rgba(255, 255, 255, 0.7); /* White with 70% opacity */
            backdrop-filter: blur(10px); /* Apply blur effect */
            -webkit-backdrop-filter: blur(10px); /* Safari prefix */
            border-radius: 1rem; /* Slightly larger radius */
            padding: 1.75rem; /* Slightly more padding */
            border: 1px solid rgba(226, 232, 240, 0.5); /* Lighter border with transparency */
            box-shadow: 0 4px 12px var(--shadow-color);
            transition: transform 0.3s ease-out, box-shadow 0.3s ease-out, background-color 0.3s ease-out;
            overflow: hidden; /* Ensure content doesn't overflow */
            position: relative; /* For potential pseudo-elements */
        }

        /* Removed ::before pseudo-element for a cleaner look */


        .bento-item:hover {
            transform: translateY(-6px);
            box-shadow: 0 10px 20px var(--shadow-color), 0 4px 8px rgba(15, 23, 42, 0.06); /* Adjusted hover shadow */
        }

        .paper-title {
            font-size: 1.125rem; /* Tailwind text-lg */
            font-weight: 600; /* Tailwind font-semibold */
            color: var(--highlight-primary); /* Use new primary highlight */
            margin-bottom: 0.75rem; /* Tailwind mb-3 */
            line-height: 1.4;
        }

        .paper-summary {
            font-size: 0.875rem; /* Tailwind text-sm */
            color: var(--text-muted-color);
            margin-bottom: 1.25rem; /* Tailwind mb-5 */
            line-height: 1.6;
        }

        .paper-link {
            display: inline-flex; /* Use flex for icon alignment */
            align-items: center;
            font-size: 0.875rem; /* Tailwind text-sm */
            font-weight: 600;
            color: var(--highlight-primary);
            text-decoration: none;
            padding: 0.5rem 1rem; /* Add padding */
            border-radius: 0.5rem; /* Slightly rounder */
            background-color: rgba(20, 184, 166, 0.08); /* Subtle teal background */
            border: 1px solid rgba(20, 184, 166, 0.2);
            transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
        }

        .paper-link i {
            margin-right: 0.5rem; /* Tailwind mr-2 */
            transition: transform 0.3s ease;
        }

        .paper-link:hover {
            background-color: rgba(20, 184, 166, 0.15);
            color: #0d9488; /* Darker teal on hover */
            transform: translateY(-1px);
        }
        .paper-link:hover i {
             transform: translateX(2px);
        }

        .paper-authors {
            font-size: 0.75rem; /* Tailwind text-xs */
            color: var(--text-muted-color);
            margin-top: 1rem; /* Tailwind mt-4 */
            font-style: italic;
        }

        .header {
            text-align: center;
            margin-bottom: 3rem; /* Tailwind mb-12 */
            padding-top: 3rem; /* Tailwind pt-12 */
        }

        .header h1 {
            font-size: 2.5rem; /* Tailwind text-4xl or 5xl */
            font-weight: 700; /* Tailwind font-bold */
            color: var(--header-color);
            letter-spacing: -0.025em; /* Tailwind tracking-tight */
            margin-bottom: 0.5rem;
            /* Optional: Add a subtle text gradient */
            /* background: linear-gradient(90deg, var(--highlight-primary), var(--highlight-secondary)); */
            /* -webkit-background-clip: text; */
            /* -webkit-text-fill-color: transparent; */
        }

        .header p {
            font-size: 1.125rem; /* Tailwind text-lg */
            color: var(--text-muted-color);
            margin-top: 0.5rem; /* Tailwind mt-2 */
            max-width: 600px;
            margin-left: auto;
            margin-right: auto;
        }

        .footer {
            text-align: center;
            color: var(--text-muted-color);
            font-size: 0.875rem; /* Tailwind text-sm */
            padding-top: 2rem;
            padding-bottom: 2rem; /* Tailwind py-8 */
            border-top: 1px solid var(--border-color);
            margin-top: 4rem;
        }

        /* Simple line graphic element (optional) */
        .line-graphic {
            height: 1px; /* Thinner line */
            background: linear-gradient(90deg, rgba(20, 184, 166, 0), var(--highlight-primary), rgba(20, 184, 166, 0));
            opacity: 0.6;
            margin: 1.5rem 0; /* Adjust margin */
        }

        /* Framer Motion requires the script, styles enhance appearance */
        [data-motion-element] {
             /* Base styles for elements animated by Framer Motion */
        }

        .paper-tldr {
            font-size: 0.95rem; /* Slightly bigger than summary */
            color: #475569; /* Changed to Tailwind slate-600 (slightly darker than summary) */
            margin-top: 0.75rem; /* Tailwind mt-3 */
            margin-bottom: 0.75rem; /* Tailwind mb-2 */
            /* font-style: italic; */
            font-weight: bold;
        }

        .paper-rating {
            margin-top: 1rem; /* Tailwind mt-4 */
            margin-bottom: 1rem; /* Tailwind mb-4 */
            color: #f59e0b; /* Tailwind amber-500 */
        }

        .paper-rating i {
            margin-right: 0.125rem; /* Tailwind mr-0.5 */
        }

        /* Apply consistent star color to sub-ratings */
        .paper-sub-ratings .rating-item i {
            color: #f59e0b; /* Match overall rating star color (amber-500) */
            margin-right: 0.125rem; /* Consistent spacing */
        }

    </style>
</head>
<body class="container mx-auto px-4 antialiased">

    <motion.div
        initial="{ opacity: 0, y: -30 }"
        animate="{ opacity: 1, y: 0 }"
        transition="{ duration: 0.6, ease: 'easeOut' }"
        class="header"
        data-motion-element
    >
        <h1>AIGC Daily Papers</h1>
        <p>Daily papers related to Image/Video/Multimodal Generation from cs.CV</p>
        <p>{{ report_date.strftime('%B %d, %Y') }}</p>
        <div class="line-graphic mt-4 mb-8 mx-auto w-1/4"></div> <!-- Added line graphic -->
    </motion.div>

    <div class="bento-grid" id="paper-grid">
        {% for paper in papers %}
        <motion.div
            initial="{ opacity: 0, y: 50, scale: 0.9 }"
            whileInView="{ opacity: 1, y: 0, scale: 1 }"
            viewport="{ once: true, amount: 0.2 }" /* Trigger when 20% is visible */
            transition="{ duration: 0.5, delay: {{ loop.index0 * 0.05 }}, ease: 'easeOut' }"  {# Jinja variable needs braces #}
            class="bento-item"
            data-motion-element
        >
            <h2 class="paper-title">{{ paper.title }}</h2>
            <p class="paper-summary">{{ paper.summary }}</p>
            {% if paper.tldr %}
            <p class="paper-tldr"><strong>TLDR</strong>: {{ paper.tldr }}</p>
            {% endif %}
            {% if paper.tldr_zh %}
            <p class="paper-tldr"><strong>TLDR</strong>: {{ paper.tldr_zh }}</p>
            {% endif %}

            {# New block for the four scores #}
            {% if paper.relevance_score is defined and paper.relevance_score is not none or
                  paper.novelty_claim_score is defined and paper.novelty_claim_score is not none or
                  paper.clarity_score is defined and paper.clarity_score is not none or
                  paper.potential_impact_score is defined and paper.potential_impact_score is not none %}
            <div class="paper-sub-ratings" style="display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 5px; font-size: 0.8em;">
                {% if paper.relevance_score is defined and paper.relevance_score is not none %}
                <div class="rating-item">
                    <span class="rating-label">Relevance:</span>
                    {% set score = paper.relevance_score / 2 %}
                    {% for i in range(5) %}{% if score >= i + 1 %}<i class="fas fa-star"></i>{% elif score >= i + 0.5 %}<i class="fas fa-star-half-alt"></i>{% else %}<i class="far fa-star"></i>{% endif %}{% endfor %}
                    <span class="text-xs text-gray-500 ml-1">({{ paper.relevance_score }}/10)</span>
                </div>
                {% endif %}
                {% if paper.novelty_claim_score is defined and paper.novelty_claim_score is not none %}
                <div class="rating-item">
                    <span class="rating-label">Novelty:</span>
                    {% set score = paper.novelty_claim_score / 2 %}
                    {% for i in range(5) %}{% if score >= i + 1 %}<i class="fas fa-star"></i>{% elif score >= i + 0.5 %}<i class="fas fa-star-half-alt"></i>{% else %}<i class="far fa-star"></i>{% endif %}{% endfor %}
                    <span class="text-xs text-gray-500 ml-1">({{ paper.novelty_claim_score }}/10)</span>
                </div>
                {% endif %}
                {% if paper.clarity_score is defined and paper.clarity_score is not none %}
                <div class="rating-item">
                    <span class="rating-label">Clarity:</span>
                    {% set score = paper.clarity_score / 2 %}
                    {% for i in range(5) %}{% if score >= i + 1 %}<i class="fas fa-star"></i>{% elif score >= i + 0.5 %}<i class="fas fa-star-half-alt"></i>{% else %}<i class="far fa-star"></i>{% endif %}{% endfor %}
                    <span class="text-xs text-gray-500 ml-1">({{ paper.clarity_score }}/10)</span>
                </div>
                {% endif %}
                {% if paper.potential_impact_score is defined and paper.potential_impact_score is not none %}
                <div class="rating-item">
                    <span class="rating-label">Potential Impact:</span>
                    {% set score = paper.potential_impact_score / 2 %}
                    {% for i in range(5) %}{% if score >= i + 1 %}<i class="fas fa-star"></i>{% elif score >= i + 0.5 %}<i class="fas fa-star-half-alt"></i>{% else %}<i class="far fa-star"></i>{% endif %}{% endfor %}
                    <span class="text-xs text-gray-500 ml-1">({{ paper.potential_impact_score }}/10)</span>
                </div>
                {% endif %}
            </div>
            {% endif %}
            {# End of new block #}

            {% if paper.overall_priority_score is defined and paper.overall_priority_score is not none %}
            <div class="paper-rating">
                <span class="rating-label" style="color: #000; font-weight: bold;">Overall:</span>
                {% set score = paper.overall_priority_score / 2 %}
                {% for i in range(5) %}
                    {% if score >= i + 1 %}
                        <i class="fas fa-star"></i>{# Full star #}
                    {% elif score >= i + 0.5 %}
                        <i class="fas fa-star-half-alt"></i>{# Half star #}
                    {% else %}
                        <i class="far fa-star"></i>{# Empty star #}
                    {% endif %}
                {% endfor %}
                <span class="text-xs text-gray-500 ml-1">({{ paper.overall_priority_score }}/10)</span>
            </div>
            {% endif %}

            <a href="{{ paper.url }}" target="_blank" class="paper-link">
                <i class="fas fa-file-pdf mr-1"></i> Read Paper (PDF)
            </a>
            {% if paper.authors %}
            <p class="paper-authors">Authors: {{ paper.authors | join(', ') }}</p>
            {% endif %}
        </motion.div>
        {% else %}
        <motion.div
            initial="{ opacity: 0 }"
            animate="{ opacity: 1 }"
            transition="{ duration: 0.5 }"
            class="bento-item col-span-full text-center text-gray-500"
            data-motion-element
        >
            <p>No relevant papers found for today.</p>
        </motion.div>
        {% endfor %}
    </div>

    <footer class="footer">
        Generated on {{ generation_time.strftime('%Y-%m-%d %H:%M:%S') }} UTC. Powered by <a href="https://github.com/onion-liu" target="_blank">onion-liu</a>.
    </footer>

</body>
</html>